import React, {useEffect, useState} from 'react'
import BatchUpload from '@/components/BatchUpload'
import {
	getExclChannel,
	postExcChannel,
	getDataSettlement,
} from '@/service/merchantCenter/clue'

function ExportExcl(props: any) {
	const {info, sunchange, getData} = props
	const [importDriverId, setImportDriverId] = useState(false) // 导入渠道列表
	useEffect(() => {
		setImportDriverId(info)
	}, [info])
	const childCange = (value: any) => {
		if (sunchange) {
			sunchange(value)
		}
	}
	// const [fileObj, setFileObj] = useState<any>()
	const column = [
		{
			title: '所属主体',
			dataIndex: 'subjectName',
			align: 'center',
			key: 'subjectName',
			width: 200,
		},
		{
			title: '城市',
			dataIndex: 'cityName',
			align: 'center',
			key: 'cityName',
			width: 100,
		},
		{
			title: '所属公司',
			dataIndex: 'orgName',
			align: 'center',
			key: 'orgName',
			width: 100,
		},
		{
			title: 'AMC一级渠道类型',
			dataIndex: 'firstLevelType',
			align: 'center',
			key: 'firstLevelType',
			width: 100,
		},
		{
			title: 'AMC二级渠道类型',
			dataIndex: 'secondLevelType',
			align: 'center',
			key: 'secondLevelType',
			width: 100,
		},
		{
			title: '渠道名称',
			dataIndex: 'ditchName',
			align: 'center',
			key: 'ditchName',
			width: 100,
		},
		{
			title: '渠道code码',
			dataIndex: 'code',
			align: 'center',
			key: 'code',
			width: 100,
		},
		{
			title: '联系电话',
			dataIndex: 'phone',
			align: 'center',
			key: 'phone',
			width: 100,
		},
		{
			title: '身份证',
			dataIndex: 'cardId',
			align: 'center',
			key: 'cardId',
			width: 100,
		},
		{
			title: '邮箱',
			dataIndex: 'email',
			align: 'center',
			key: 'email',
			width: 100,
		},
		{
			title: '推荐人司机ID',
			dataIndex: 'driverId',
			align: 'center',
			key: 'driverId',
			width: 100,
		},
		{
			title: '开户银行',
			dataIndex: 'depositBank',
			align: 'center',
			key: 'depositBank',
			width: 100,
		},
		{
			title: '开户支行',
			dataIndex: 'depositBankName',
			align: 'center',
			key: 'depositBankName',
			width: 100,
		},
		{
			title: '银行账号',
			dataIndex: 'bankCard',
			align: 'center',
			key: 'bankCard',
			width: 100,
		},
		{
			title: '备注',
			dataIndex: 'description',
			align: 'center',
			key: 'description',
			width: 100,
		},
		{
			title: '状态',
			dataIndex: 'reason',
			align: 'center',
			key: 'reason',
			width: 200,
			fixed: 'right',
		},
	]
	return (
		<BatchUpload
			isModalOpen={importDriverId}
			setIsModalOpen={setImportDriverId}
			importData={getExclChannel} // 导入接口
			onTableList={getDataSettlement} // 获取列表数据-失败
			getListData={() => getData({})} // 获取列表数据-成功
			columns={column}
			sourceId={42}
			templateType="渠道管理导入模板"
			uploadFileUrl={postExcChannel} // 文件上传接口
			title="导入渠道列表"
			childCange={childCange}
			width={800}
			clue="2"
		/>
	)
}

export default ExportExcl
